# Python 2.6.4
# Project Euler, Problem 168
# Copyright 2010 Talha Zaman

def make(d, n, l):
    a, carry = [d], 0
    for i in range(l):
        a.append((a[i]*n + carry)%10)
        carry = (a[i]*n + carry)/10
    if a[-1]==a[0] and a[-2] and not carry:
        return sum(a[i]*10**i for i in range(len(a)-1))
total = 0
for l in range(2,101):
    for d in range(1,10):
        for n in range(1,10):
            x = make(d, n, l)
            if x: total = (total+x)%100000
print total
